﻿using Beaker;
using OpenCube.Nbt.Mapping;

namespace OpenCube.Model.Primitives.Converters
{
	public sealed class BooleanStringConverter
		: NbtSimpleTypeConverter<bool, string>
	{
		protected override bool ConvertToModelValue(string nbtValue)
		{
			if (nbtValue == "true")
				return true;

			return false;
		}

		protected override Maybe<string> ConvertToNbtValue(bool modelValue)
		{
			if (modelValue == true)
				return "true";
			return "false";
		}
	}
}